#!/bin/sh
# This regression test is a part of SIPp.
# Validate RTP extraction when INVITE body is multipart/mixed with SDP + PIDF-LO.
. "`dirname "$0"`/../functions"; init

uac_media_port=5072

udplisten $uac_media_port >udplisten.log &
udplisten_job=$!
trap "kill -9 $udplisten_job 2>/dev/null" EXIT

sippbg -sf uas.xml -i 127.0.0.1 -p 5070 -m 1
sippfg -m 1 -sf uac.xml 127.0.0.1:5070 -i 127.0.0.1 \
    -trace_msg -message_file tmp.log -timeout 6 -timeout_error >/dev/null 2>&1
status=$?

test $status -ne 0 && fail "SIPp UAC job failed"

port=`sed -e '/^Connectionless from/!d;s/.*://' udplisten.log`
if test -n "$port"; then
    ok
else
    fail "got no RTP at all"
fi
